import $ from '../../http'
// 树形下拉
const userAllList = data => {
  return $.jsonPost('/js/util/Jsonutil/userAllList', data)
}
// 部门树形下拉
const allDept = data => {
  return $.jsonPost('/js/util/Jsonutil/allDept', data)
}
// 创新工作室/js/util/Jsonutil/studio
const studiotree = data => {
  return $.jsonPost('/js/util/Jsonutil/studio', data)
}
// 成果形式下拉
const amtf = () => {
  // return $.jsonPost("pc/warehouse/mc/ls");
  const dao = {
    url: '/js/util/Jsonutil/amtf',
    out(re) {
      delete re.navi
      const { data } = re
      console.log(data)
      if (re.data) {
        re.data = data.map(r => {
          return {
            key: String(r.ID),
            txt: r.NM
          }
        })
      }
      return re
    }
  }
  return $.jsonPost(dao)
}
// 多、选
const amtfmore = () => {
  // return $.jsonPost("pc/warehouse/mc/ls");
  const dao = {
    url: '/js/util/Jsonutil/amtf',
    out(re) {
      delete re.navi
      const { data } = re
      console.log(data)
      if (re.data) {
        re.data = data.map(r => {
          return {
            key: r.ID,
            txt: r.NM
          }
        })
      }
      return re
    }
  }
  return $.jsonPost(dao)
}
// 先进性下拉
const progress = () => {
  // return $.jsonPost("pc/warehouse/mc/ls");
  const dao = {
    url: '/js/util/Jsonutil/progress',
    out(re) {
      delete re.navi
      const { data } = re
      console.log(data)
      if (re.data) {
        re.data = data.map(r => {
          return {
            key: String(r.ID),
            txt: r.NM
          }
        })
      }
      return re
    }
  }
  return $.jsonPost(dao)
}
// 获取人员的详细信息/js/util/Jsonutil/userinfo
const userinfo = data => {
  return $.jsonPost('/js/util/Jsonutil/userinfo', data)
}
export default {
  // abstractV,
  userAllList,
  allDept,
  studiotree,
  amtf,
  progress,
  amtfmore,
  userinfo
}
